Cache builtin function resolution result#13982
Conversation
rongrong
commented
Jan 17, 2020
436bcff to
7e731ca
Compare
| transactionManager.registerFunctionNamespaceManager(BuiltInFunctionNamespaceManager.ID, builtInFunctionNamespaceManager); | ||
| this.functionCache = CacheBuilder.newBuilder() | ||
| .recordStats() | ||
| .maximumSize(1000) |
There was a problem hiding this comment.
We have 500+ functions, with high chances of different parameterTypes resolving to the same function, the cache could easily exceeds 1k entries after a reasonable amount of queries are executable. What about giving it a more generous size, like 10k? Or even better, make else it configurable?
There was a problem hiding this comment.
The goal is not to cache everything. Caching the top use cases is enough. The major target is the operators that's used over and over again in query planning (e.g., operator$equal(varchar, varchar) is used for every partition in PickTableLayout. Shadow testing showed that depending on the workload, No.1 hit can be 1 to 3 orders of magnitude higher than No.5. The overhead of resolving one function that's actually used in query is not that much. It's not clear to me that the processing time saved would worth the memory spent for the majority of the functions.